<template>
	<div class="main">
		<div class="main-search">
			<span>学科：</span>
			<span style="margin-right: 20px">数学</span>
			<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"
					 label-width="114px">
				<el-form-item label="题目ID" prop="tId">
					<el-input
						v-model="queryParams.tId"
						placeholder="请输题目ID"
						clearable
						style="width: 200px"
						@keyup.enter="handleQuery"
					/>
				</el-form-item>
				<el-form-item label="审核状态" prop="status">
					<el-select style="width: 200px" v-model="queryParams.status">
						<el-option
							v-for="(item, index) in [{label:'通过',value:1},{label:'拒绝',value:-1}]"
							:key="index"
							:label="item.label"
							:value="item.value"
						/>
					</el-select>
				</el-form-item>
				<el-form-item label="应用状态" prop="tStatus">
					<el-select style="width: 200px" v-model="queryParams.tStatus">
						<el-option
							v-for="(item, index) in [{label:'上架中',value:1},{label:'已上架',value:2},{label:'下架',value:-1}]"
							:key="index"
							:label="item.label"
							:value="item.value"
						/>
					</el-select>
				</el-form-item>

				<el-form-item>
					<el-button :icon="Search" type="primary" @click="handleQuery">搜索</el-button>
				</el-form-item>
			</el-form>
		</div>

		<el-table class="cl-table" v-loading="loading" :data="courseList" @selection-change="handleSelectionChange">
			<el-table-column label="题目ID" align="center" prop="configId" />
			<el-table-column label="题目来源" align="center" prop="configName"
							 :show-overflow-tooltip="true" />
			<el-table-column label="题目类型" align="center" prop="configKey"
							 :show-overflow-tooltip="true" />
			<el-table-column label="题目属性" align="center" prop="configValue"
							 :show-overflow-tooltip="true" />
			<el-table-column label="题目难度" align="center" prop="configType" />
			<el-table-column label="题目内容" align="center" prop="remark" :show-overflow-tooltip="true" />
			<el-table-column label="推荐用时" align="center" prop="remark" :show-overflow-tooltip="true" />
			<el-table-column label="关联知识点" align="center" prop="remark"
							 :show-overflow-tooltip="true" />
			<el-table-column label="前测课程" align="center" prop="createTime" />
			<el-table-column label="创建人" align="center" prop="createTime" />
			<el-table-column label="最后修改人" align="center" prop="createTime" />

			<el-table-column  fixed="right" label="操作" align="center" class-name="small-padding fixed-width">
				<template #default="scope">
					<el-button

						type="text"
						icon="Edit"
						@click="handleUpdate(scope.row)"
						v-hasPermi="['system:config:edit']"
					>修改
					</el-button>
					<el-button

						type="text"
						icon="Delete"
						@click="handleDelete(scope.row)"
						v-hasPermi="['system:config:remove']"
					>删除
					</el-button>
				</template>
			</el-table-column>
		</el-table>

		<pagination
			v-show="total>0"
			:total="total"
			v-model:page="queryParams.pageNum"
			v-model:limit="queryParams.pageSize"
			@pagination="getList"
		/>

	</div>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue';
import { Search } from '@element-plus/icons-vue';
import aselect from '../../common/aselect/index.vue';
import { timunandu } from '../../question/views/data';
import type { FormInstance } from 'element-plus';
// 数据定义
const loading = ref(false);
const ids = ref([]);
const multiple = ref(true);
const showSearch = ref(true);
const total = ref(0);
const courseList = ref([]);
const title = ref('');
const open = ref(false);

const queryForm = ref<FormInstance>();
const formRef = ref<FormInstance>();

const queryParams = reactive({
	pageNum: 1,
	pageSize: 10,
	status: '',
	tStatus: ''
});

const form = reactive({
	version: [],
	place: '',
	leixing: '',
	shuxing: '',
	nandu: '',
	miao: '',
	course: [
		{ versionId: '', courseId: '', chapterId: '', sectionId: '' }
	],
	prefaceKnowledge: []
});

const rules = reactive({});

const getList = () => {
	/*loading.value = true
	listConfig({ ...queryParams, ...dateRange.value }).then(response => {
	  courseList.value = response.rows
	  total.value = response.total
	  loading.value = false
	})*/
};



const reset = () => {
	Object.assign(form, {
		title: [],
		category: [],
		tags: []
	});

	formRef.value?.resetFields();
};

const handleQuery = () => {
	queryParams.pageNum = 1;
	getList();
};

const resetQuery = () => {
	queryForm.value?.resetFields();
	handleQuery();
};

// 生命周期
onMounted(() => {
	getList();
});
</script>

